﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PetaPoco;
using Shop.User.Models;

namespace Shop.User.Repositories
{
    public class UsersAccess
    {

        private Database DB = new Database("ConnString");
        public UsersInfo SelectUser(string UName)
        {
            Sql sql = Sql.Builder.Append("select * from Shop_User where UName = @0", UName);
            return DB.FirstOrDefault<UsersInfo>(sql);
        }

        public UsersInfo SelectUserByid(int UID)
        {
            Sql sql = Sql.Builder.Append("select * from Shop_User where UID = @0", UID);
            return DB.FirstOrDefault<UsersInfo>(sql);
        }
        public object InsertUsers(UsersInfo NInfo)
        {
            return DB.Insert("Shop_User", "UID", NInfo);
        }

        public object UpdateUsers(string  sql,params string[] paramssql)
        {
            return DB.Execute(sql,paramssql);
        }

    }
}
